import { ThunkAction } from "redux-thunk";
import { RootState } from "../index";
export const GET = "get";
export const SET = "set";

interface GETNAME {
  type: typeof GET;
}
interface SETNAME {
  type: typeof SET;
  payload: any;
}
export type NameAction = GETNAME | SETNAME;
export const getActionCreater = (): GETNAME => {
  return {
    type: GET,
  };
};
export const setActionCreater = (data: any): SETNAME => {
  return {
    type: SET,
    payload: data,
  };
};
export const timerSetActionCreater = (
  data: any
): ThunkAction<void, RootState, unknown, NameAction> => (
  dispatch,
  getState
) => {
  setTimeout(() => {
    dispatch(setActionCreater(data));
  }, 3000);
};
